package com.forever7776.life.core.service.impl.sys;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.forever7776.life.core.entity.sys.SysRoleUser;
import com.forever7776.life.core.mapper.sys.SysRoleUserMapper;
import com.forever7776.life.core.service.sys.ISysRoleUserService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 角色用户表 服务实现类
 * </p>
 *
 * @author kz
 * @since 2018-01-18
 */
@Service
public class SysRoleUserServiceImpl extends ServiceImpl<SysRoleUserMapper, SysRoleUser> implements ISysRoleUserService {

    /**
     * 根据用户ID查询角色ID
     *
     * @param userId
     * @return
     */
    @Override
    public String selectRoleIdByUserId(String userId) {
        return (String) selectObj(new EntityWrapper<SysRoleUser>().eq("user_id", userId).setSqlSelect("role_id"));
    }
}
